package com.spx.kernel.service;

import java.util.Properties;
import java.util.Set;

import javax.persistence.EntityManager;

import com.spx.kernel.types.ModelType;

public interface PersistService
{

	public void setProperties(Properties properties);

	public void start();

	public EntityManager getEntityManager();

	public void addType(Class<? extends ModelType> clazz);

	public void addTypes(Set<Class<? extends ModelType>> modelList);

	public void begin();

	public void rollback();

	public void commit();

	public void persist(ModelType persistant);

	public Set<Class<? extends ModelType>> getTypes();

	public void rename(ModelType model, String newName);

	public ModelType findByName(String newName);

	public void update(ModelType model);

	public <T extends ModelType> void addChangeListener(Class<T> clazz, UpdateListener l);

	public <T extends ModelType> T findByName(String name, Class<T> clazz);

	public <T extends ModelType> Set<T> findAll(Class<T> clazz);

    public Object getTransactionalProxy(Object obj);

    public <T,O extends Object>  T getTransactionalProxy(O obj, Class<T> clazz);

}
